//
//  ViewController.m
//  DEMO
//
//  Created by J on 16/2/19.
//  Copyright © 2016年 J. All rights reserved.
//

#define MAS_SHORTHAND
#define MAS_SHORTHAND_GLOBALS

#import "Masonry.h"
#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    UIView* blueView = UIView.new;
    blueView.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:blueView];
    
    
    
    UIView* purpleView = UIView.new;
    purpleView.backgroundColor = [UIColor purpleColor];
    [self.view addSubview:purpleView];
    
    
    CGFloat margin = 20;
    CGFloat height = 50;
    
    [blueView makeConstraints:^(MASConstraintMaker *make) {
        
        
        make.left.offset(margin);
        make.right.equalTo(purpleView.left).offset(-margin);
        make.bottom.equalTo(self.view.bottom).offset(-margin);
        make.height.equalTo(height);
        
     
        
        
    }];
    
    [purpleView makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view.right).offset(-margin);
        make.top.equalTo(blueView.top);
        make.bottom.equalTo(blueView.bottom);
        make.width.equalTo(blueView.width);
        
    }];
    
    
    
}



@end
